//
//  jxsListViewController.h
//  ToDoList
//
// This code file is apart of project "iPhone-ToDo-List" 
// (http://code.google.com/p/iphone-todo-list/)
//
// Copyright (c) 2009 Frank Villasenor
//
// Distributed under the terms of the Lesser GNU General Public License.
// A copy of the license should be with these files. If not, you 
// can retrieve a copy from http://www.gnu.org/licenses/lgpl-3.0.txt
// 

#import <UIKit/UIKit.h>
#import "jxsTaskReceiver.h"

typedef enum 
{
	jxsTaskListFilterShowAll,
	jxsTaskListFilterShowIncomplete,
	jxsTaskListFilterShowDueSoon
} jxsTaskListFilter;

@class tosuTask;
@class jxsViewTaskDetailsViewController;

@interface jxsListViewController : UIViewController
	<UITableViewDelegate, UITableViewDataSource, jxsTaskReceiver>
{
	NSMutableArray *taskList;
	NSMutableArray *taskListForDisplay;
	
	UITableView *taskListTableView;
	UISegmentedControl *segmentedFilter;
	
	jxsViewTaskDetailsViewController *viewTaskDetailsViewController;
	jxsListViewController *listViewController;
	
	jxsTaskListFilter currentTaskListFilter;
	
	tosuTask *selectedTask;
}

//
// There are two tasks lists. Why? Because 
// the taskListForDisplay will be changed
// based on the filter that is currently
// selected.
@property (retain) NSMutableArray *taskList;
@property (retain) NSMutableArray *taskListForDisplay;

@property (retain, nonatomic) IBOutlet UITableView *taskListTableView;
@property (retain, nonatomic) IBOutlet UISegmentedControl *segmentedFilter;

//
// Holds the DetailsViewController (needed if at bottom object)
// otherwise, probably nil.
@property (retain) jxsViewTaskDetailsViewController *viewTaskDetailsViewController;

//
// Holds another instances of this objects if 
// the selected task contains other tasks. [Still considering this]
@property (retain) jxsListViewController *listViewController;


@property jxsTaskListFilter currentTaskListFilter;

@property (retain, readonly) tosuTask *selectedTask;

//
// Since this viewController contains the list
// of items to dispaly, this method can add
// objects to this list. 
- (void)addTaskListTaskItem:(tosuTask *)taskToAdd;

- (void)applicationWillTerminate:(NSNotification *)notification;

- (IBAction)changeFilter:(id)sender;

- (NSMutableArray *)createFilteredTaskListForDisplay;
- (void)setTaskListForDisplay;

- (void)updateTaskListDisplay;

@end
